#include <iostream>
#include <sstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
using std::ostringstream;

void test0(){
    int num = 123, num2 = 456;
    ostringstream oss;
    //把各种类型的数据都传给了字符串输出流对象
    //相当于自己准备一个缓冲区中保存各种类型数据
    oss << "num = " << num << " , num2 = " << num2 << endl;

    //将缓冲区中的内容拼接成string
    string res = oss.str();
    cout << res << endl;

    string str("hello");
    string str2 = str + ",world" + std::to_string(4);
}

int main(void){
    test0();
    return 0;
}
